package com.rem.hutool.my12Excel;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.poi.excel.BigExcelWriter;
import cn.hutool.poi.excel.ExcelUtil;

import java.util.List;

/**
 * @author Rem
 * @date 2021-10-28
 */

public class ExcelExport {

    public static void main(String[] args) {

        long l = System.currentTimeMillis();
        List<List<?>> rows = CollUtil.newArrayList();
        List<?> row1 = CollUtil.newArrayList("门店仓编码", "商品编码", "建议值");
        rows.add(row1);
        for (int i = 0; i < 100000; i++) {
            rows.add(CollUtil.newArrayList(2021, 10000001 + i, 101 + i));
        }


        // ExcelWriter writer = ExcelUtil.getWriter("d:/xxx1.xlsx");
        BigExcelWriter writer = ExcelUtil.getBigWriter("d:/xxx5.csv");
        // 一次性写出内容，使用默认样式
        writer.write(rows);
        // 关闭writer，释放内存
        long l2 = System.currentTimeMillis();
        System.err.println(l2 - l);
        writer.close();

    }
}
